summaryrefslogtreecommitdiff
path: root/src/tests/binary.cpp
blob: 3e2cbc714588d1d81441f77215abf39fc3206788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "genetic/phenotypebinary.h"
#include "genetic/operatorbasic.h"

#include <bu/sio.h>
#include <bu/random.h>
#include <bu/randomcmwc.h>
#include <bu/randomsystem.h>
#include <time.h>

using namespace Bu;

int main( int argc, char *argv[] )
{
	Bu::Random::setGenerator<Bu::RandomCmwc>();
	Bu::Random::seed( time( NULL ) );

	Genetic::OperatorBasic op( new Genetic::PhenotypeBinary( 3453120 ), 0.000125 );
	Genetic::Phenotype *pPb1 = op.random();
	Genetic::Phenotype *pPb2 = op.random();
	Genetic::Phenotype *pPb3;

//	sio << pPb1->toString() << sio.nl;
//	sio << pPb2->toString() << sio.nl;

	Genetic::PhenotypeList lParents;
	lParents.append( pPb1 );
	lParents.append( pPb2 );

	for( int j = 0; j < 1000; j++ )
	{
		delete op.mate( lParents );
	}

//	pPb3 = pPb1->makeEmptyOffspring();
//	pPb3->copyFrom( *pPb1, 4, 88 );
//	sio << pPb3->toString() << sio.nl;

	delete pPb1;
	delete pPb2;
//	delete pPb3;

	return 0;
}